package com.worktest.test.tests.service;

import com.worktest.test.tests.dao.UserDao;
import com.worktest.test.tests.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImple implements UserService{
    @Autowired
    private UserDao userDao;
    @Override
    public void addUser(User user) {
        userDao.save(user);
    }

    @Override
    public void delUser(Integer id) {
        userDao.deleteById(id);
    }

    @Override
    public void updateUser(User user) {
        userDao.save(user);
    }

    @Override
    public User findOne(Integer id) {
        return userDao.getOne(id);
    }

    @Override
    public List<User> findAllUser() {
        return userDao.findAll();
    }
}
